home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.lang.c
- Subject: Re: Problem Negating an Unsigned Char
- Date: 4 Mar 1996 20:56:05 -0600
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4hgag5$8r8@solutions.solon.com>
- References: <Dnnros.Lq.0.-s@hkusuc.hku.hk> <4he27sINNdel@keats.ugrad.cs.ubc.ca> <4he5f0$acv@solutions.solon.com> <4hfkk6INN2tm@keats.ugrad.cs.ubc.ca>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4hfkk6INN2tm@keats.ugrad.cs.ubc.ca>,
- Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
- >In article <4he5f0$acv@solutions.solon.com>,
- >Peter Seebach <seebs@solutions.solon.com> wrote:
- > >In article <4he27sINNdel@keats.ugrad.cs.ubc.ca>,
- > >Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
- > >>To make it portable, you must manually mask for the lower eight bits:
-
- > >> if (a == (~b & 0xff))
-
- > >Close, but the cigar yet escapes you.
-
- >No it does not. I _wanted_ eight bit arithmetic, not CHAR_BIT arithmetic.
-
- Oh. I assumed the goal was to get the effect of negating all the bits in
- a char. Never mind.
-
- >Your shift, not mine!
-
- >I would just AND with UCHAR_MAX. I don't think there is any possibility that
- >it could be anything other than a dyadic power, less one.
-
- Neither do I, but I'm naturally cautious, often in entirely irrelevant
- directions.
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- FUCK the communications decency act. Goddamned government. [literally.]
- The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
-